
{% extends 'project/layout.html' %}
{% load static %}
{% block title %}
项目管理
{% endblock%}
{% block css%}
<link rel="stylesheet" href="{% static 'plugin/md-master/css/editormd.css' %}">
<style>
  .title{
    border-right: 2px solid #ccc;
    min-height: 600px;
  }
  .content{
    min-height: 600px;
    text-align: center;
  }

</style>

{% endblock %}
{% block content %}
  <!--  内容区域-->
  <div class="container-fluid">
    <div class="panel panel-info">
      <div class="panel-heading"><i class="iconfont icon-caidan"></i>wiki知识库</div>
      <div class="panel-body">
        <!-- 左侧菜单栏       -->
        <div class="col-sm-3 title">
          <a
             style="cursor:pointer;text-decoration: none"
             data-toggle="collapse"
             data-target="#er"
             aria-expanded="false"
             >
              一级菜单
          </a>
          <div class="collapse" id="er">
              <div style="margin-left: 10px">
                <a style="cursor:pointer;text-decoration: none">二级菜单</a>
              </div>
          </div>
        </div>
        <!-- 右侧内容区域       -->
         <div class="col-sm-9 content">
            <!-- 新建wiki 表单          -->
            <form novalidate method="post">
              {% csrf_token %}
              {% for item in form %}
                {% if item.name == 'content' %}
                    <div class="form-group">
                      <label for="{{item.id_for_label}}">{{item.label}}</label>
                        <div id="editor">
                            {{item}}
                        </div>
                      <span class="error-msg">{{item.errors.0}}</span>
                    </div>
                {% else %}
                    <div class="form-group">
                      <label for="{{item.id_for_label}}">{{item.label}}</label>
                      {{item}}
                      <span class="error-msg">{{item.errors.0}}</span>
                    </div>
                {% endif %}
              {% endfor %}
              <button type="submit" class="btn btn-default">新建</button>
            </form>
         </div>
        </div>
    </div>
  </div>

{% endblock%}

{% block js %}
<script src="{% static 'plugin/md-master/editormd.js' %}"></script>
<script>
    //初始化编辑器为markdown编辑器
    function initEditor(){
        editormd('editor',{
            placeholder : ' 请输入内容',
            height :500,
            path:'{% static "plugin/md-master/lib/" %}',
            // imageUpload:false,
            // imageFormats : ['jpg','jpeg','png','gif'],
            imageUploadURL:'{% url "web:wiki_upload" project_id=request.tracer.project.id %}',
            imageUpload    : true,
            crossDomainUpload : false,
            imageFormats   : ["jpg", "jpeg", "gif", "png", "bmp", "webp"],
            // imageUploadURL : "./php/upload.php",
        })
    }
    initEditor()
</script>
{% endblock%}